import networkx.algorithms.community as community
import os
import sys
curpath = os.path.dirname(os.path.abspath(__file__)) + "/../knowledge_graph_mining/"
sys.path.append(curpath)
import prepare_graph_songs as gs
import argparse
import json

if __name__ == "__main__":
    '''
    parser = argparse.ArgumentParser()
    parser.add_argument("branid")
    parser.add_argument("workday")
    parser.add_argument("opflag")
    parser.add_argument("model_name")
    args = parser.parse_args()
    '''

    jsonpath = os.path.dirname(os.path.abspath(__file__)) + "/../../data/data.json"
    json_str = json.load(open(jsonpath))
    gs_obj = gs.GraphSongs(json_str)
    graph_songs = gs_obj.prepare_graph(list(json_str.keys()))
    communities = community.label_propagation_communities(graph_songs)
    for i in communities:
        print(i)